<template>
    <el-dialog title="选择客户预设方案" :visible.sync="dialoge7">
        <el-table :data="postList" @row-click="checkProduct">
            <el-table-column width="55" label="选择">
                <template slot-scope="scope">
                    <el-radio :value="checkData.fId" :label="scope.row.fId"></el-radio>
                </template>
            </el-table-column>
            <el-table-column label="预设编号" prop="fClientPresetCode" width="120" />
            <el-table-column label="预设名称" prop="fClientPresetName" :show-overflow-tooltip="true" align="center" />
            <el-table-column label="产品名称" prop="bcmProduct.fProductName" :show-overflow-tooltip="true" align="center" />
            <el-table-column label="产品型号" prop="bcmProduct.fDeviceModel" :show-overflow-tooltip="true" align="center" />
            <el-table-column label="尺寸" prop="bcmProduct.fProductSize" :show-overflow-tooltip="true" align="center" />
            <el-table-column label="模组类型" prop="bcmProduct.fModuleType" :show-overflow-tooltip="true" align="center" />
            <el-table-column label="IC芯片" prop="bcmProduct.fIcChip" :show-overflow-tooltip="true" align="center" />
            <el-table-column label="期待LAB范围值" align="center">
                <el-table-column v-for="(item, index) in dict.type.wf_module_color" :key="`${item.value}-${index}-${item.label}`" :label="item.label" width="50">
                    <template slot-scope="scope">
                        <div v-for="(itemL, indexL) in scope.row.bcmClientPresetDetailList" :key="`${itemL.fEntryId}-${item.label}-${indexL}`" v-if="itemL.fColor == item.value">{{ itemL.fLMin }}-{{ itemL.fLMax }}</div>
                        <div v-for="(itemA, indexA) in scope.row.bcmClientPresetDetailList" :key="`${item.label}-${indexA}-${itemA.fEntryId}`" v-if="itemA.fColor == item.value">{{ itemA.fAMin }}-{{ itemA.fAMax }}</div>
                        <div v-for="(itemB, indexB) in scope.row.bcmClientPresetDetailList" :key="`${indexB}-${itemB.fEntryId}-${item.label}`" v-if="itemB.fColor == item.value">{{ itemB.fBMin }}-{{ itemB.fBMax }}</div>
                    </template>
                </el-table-column>
                <!-- <el-table-column prop="province" label="白" width="50">
                    <template slot-scope="scope">
                        <div>{{ scope.row.fWhiteLMin }}-{{ scope.row.fWhiteLMax }}</div>
                        <div>{{ scope.row.fWhiteAMin }}-{{ scope.row.fWhiteAMax }}</div>
                        <div>{{ scope.row.fWhiteBMin }}-{{ scope.row.fWhitekBMax }}</div>
                    </template>
                </el-table-column>
                <el-table-column prop="province" label="红" width="50">
                    <template slot-scope="scope">
                        <div>{{ scope.row.fRedLMin }}-{{ scope.row.fRedLMax }}</div>
                        <div>{{ scope.row.fRedAMin }}-{{ scope.row.fRedAMax }}</div>
                        <div>{{ scope.row.fRedBMin }}-{{ scope.row.fRedBMax }}</div>
                    </template>
                </el-table-column> -->
                <!-- <el-table-column prop="province" label="黄" width="50">
            <template slot-scope="scope">
            </template>
        </el-table-column> -->
            </el-table-column>
        </el-table>
        <pagination v-show="total > 0" :total="total" :page.sync="where.pageNum" :limit.sync="where.pageSize"
            @pagination="getList" />
        <div slot="footer" class="dialog-footer">
            <el-button @click="dialoge7 = false">取 消</el-button>
            <el-button type="primary" @click="toSure">确 定</el-button>
        </div>
    </el-dialog>
</template>

<script>
import { listPreset } from '@/api/basicData/preset'
export default {
    name: 'lab',
    dicts: ['sys_normal_disable', 'wf_module_color', "bcm_preset_type"],
    data() {
        return {
            dialoge7: false,
            postList: [],
            total: 0,
            where: {
                pageNum: 1,
                pageSize: 10,
                fProductId:localStorage.getItem('productId')
            },
            checkData: { fId: '' }
        }
    },
    methods: {
        colorDetail(id) {
            return this.dict.type.wf_module_color.find(item => item.value == id).label
        },
        open() {
            this.dialoge7 = true
            this.getList()
        },
        getList() {
            this.where.fProductId = localStorage.getItem('productId')||-1
            listPreset(this.where).then(res => {
                this.postList = res.rows
                this.total = res.total
            })
        },
        checkProduct(row) {
            this.checkData = row
        },
        toSure() {
            this.dialoge7 = false
            this.postList = []
            this.where.pageNum = 1
            this.where.pageSize = 10
            this.$emit("sure", this.checkData)
            this.checkData = { fId: '' }
        }
    }
}
</script>

<style lang="scss" scoped>
::v-deep .el-radio__label {
    display: none;
}
</style>